package com.payment.ktb.activity.main4;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;

import com.payment.ktb.R;
import com.payment.ktb.activity.BaseActivity;
import com.payment.ktb.constants.ConstantsUser;
import com.payment.ktb.utils.LogUtil;
import com.payment.ktb.utils.SharedPreferencesUtils;
import com.squareup.picasso.Picasso;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by syd on 2016/6/21.
 */
public class ShowPhotoActivity extends BaseActivity {


    @BindView(R.id.iv_showphoto_picture)
    ImageView iv_showphoto_picture;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_showphoto);
        ButterKnife.bind(this);

        if ("1".equals(getIntent().getStringExtra("phototype")) && !TextUtils.isEmpty(SharedPreferencesUtils.getString(SharedPreferencesUtils.getString(ConstantsUser.phone) + ConstantsUser.PIC1))) {
                Picasso.with(mContext).load(SharedPreferencesUtils.getString(SharedPreferencesUtils.getString(ConstantsUser.phone) + ConstantsUser.PIC1)).error(R.drawable.basic_img).fit().into(iv_showphoto_picture);
        } else if ("2".equals(getIntent().getStringExtra("phototype")) && !TextUtils.isEmpty(SharedPreferencesUtils.getString(SharedPreferencesUtils.getString(ConstantsUser.phone) + ConstantsUser.PIC2))) {
            Picasso.with(mContext).load(SharedPreferencesUtils.getString(SharedPreferencesUtils.getString(ConstantsUser.phone) + ConstantsUser.PIC2)).error(R.drawable.basic_img).fit().into(iv_showphoto_picture);
        } else if ("3".equals(getIntent().getStringExtra("phototype")) && !TextUtils.isEmpty(SharedPreferencesUtils.getString(SharedPreferencesUtils.getString(ConstantsUser.phone) + ConstantsUser.PIC3))) {
            Picasso.with(mContext).load(SharedPreferencesUtils.getString(SharedPreferencesUtils.getString(ConstantsUser.phone) + ConstantsUser.PIC3)).error(R.drawable.basic_img).fit().into(iv_showphoto_picture);
        } else if ("4".equals(getIntent().getStringExtra("phototype")) && !TextUtils.isEmpty(SharedPreferencesUtils.getString(SharedPreferencesUtils.getString(ConstantsUser.phone) + ConstantsUser.PIC4))) {
            Picasso.with(mContext).load(SharedPreferencesUtils.getString(SharedPreferencesUtils.getString(ConstantsUser.phone) + ConstantsUser.PIC4)).error(R.drawable.basic_img).fit().into(iv_showphoto_picture);
        }else if ("qrcode".equals(getIntent().getStringExtra("qrcode"))) {
           iv_showphoto_picture.setImageResource(R.mipmap.ktb_qr);
        } else if ("1_sample".equals(getIntent().getStringExtra("phototype"))) {
            iv_showphoto_picture.setImageResource(R.mipmap.identification_front);
        }else if ("2_sample".equals(getIntent().getStringExtra("phototype"))) {
            iv_showphoto_picture.setImageResource(R.mipmap.identification_background);
        } else if ("3_sample".equals(getIntent().getStringExtra("phototype"))) {
            iv_showphoto_picture.setImageResource(R.mipmap.card_example);
        }  else if ("4_sample".equals(getIntent().getStringExtra("phototype"))) {
            iv_showphoto_picture.setImageResource(R.mipmap.identification_person_and_bankcard);
        }  else if ("qr_amount_notice".equals(getIntent().getStringExtra("phototype"))) {
            iv_showphoto_picture.setImageResource(R.mipmap.qr_amount_notice);
        } else {
            Picasso.with(mContext).load("http://www.error.com").error(R.drawable.basic_img).fit().into(iv_showphoto_picture);
        }


    }




    @OnClick(R.id.iv_showphoto_picture)
    public void clickEvent(View view) {


        finish();
        overridePendingTransition(R.anim.enter_anim_portrait_big_to_small, R.anim.exit_anim_portrait_big_to_small);



    }

}
